<!--
 * @Author: lihaogn
 * @Date: 2023-08-13 18:13:07
 * @LastEditTime: 2023-08-13 18:19:40
 * @LastEditor: lihaogn
 * @Description: 
 * @FilePath: \lix-css-demo\呼吸灯按钮\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>呼吸灯按钮</title>
  <style>
    .app {
      width: 100%;
      height: 100vh;
      background-color: #ffffff;
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .btn31 {
      width: 190px;
      height: 42px;
      cursor: pointer;
      border: none; /* 去掉边框 */
      border-radius: 4px;
      background-color: #333;
      font-size: 16px;
      font-weight: 700;
      color: #fff;
      transition: 0.3s;
    }

    .btn31:hover {
      background-color: #3185fa;
    }

    /* 核心代码 */
    .btn31:active {
      animation: btn31-eff 3s linear infinite;
    }

    @keyframes btn31-eff {
      0% {
        box-shadow: 0 0 2px #3185fa;
      }

      50% {
        box-shadow: 0 0 40px #3185fa;
      }

      100% {
        box-shadow: 0 0 2px #3185fa;
      }
    }
  </style>
</head>

<body>
  <div class="app">
    <button class="btn31">按住说话</button>
  </div>
</body>

</html>